//用异或运算交换两数的值
public class SwapExclusiveOr {
    public static void main(String[] args) {
        int a = 9;
        int b = 111;
        System.out.println("交换前:");
        System.out.println(a + "  "+b);
        a = a ^ b;
        b = a ^ b;   //a^b^b => a
        a = a ^ b;   //a^b^a => b
        System.out.println("交换后:");
        System.out.println(a + "  "+b);
    }

}
